
function logreg(){
    var firstname=document.getElementById("firstname").value;
    var lastname=document.getElementById("lastname").value;
    var eamiladdress=document.getElementById("emailaddress").value;
    var password=document.getElementById("password").value;
    var gender=document.getElementById("gender").value;
    console.log(firtname)
    console.log(lastname)
    console.log(emailaddress)
    console.log(password)
    console.log(gender)
    fetch("http://127.0.0.1:8080/adduser", {
    method: "POST",
    headers: {
         'Accept':'application/json',
         'Content-Type':'application/json;charset=utf-8'
        // 'Accept': 'application/json',
        // 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
        //'Content-Type':'application/json; charset=utf-8'
    },
    // body: JSON.stringify({email:email,password:password})
    body: JSON.stringify({email:email,password:password,pre_name:name,sex:sex})
})
.then((response) => response.json())
.then((data) => {
    console.log(data)
    if(data.warningCount==0){
        alert("you have done Registration!")
        window.location="/login.html"
    }
    else{
        alert("please enter again!")
    }
})
}
